package com.myblog.mapper;

import com.myblog.pojo.IndexArticle;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface Indexmapper {

    @Select("SELECT * FROM index_article ORDER BY article_id DESC")
    @Results(
            value = {
                    @Result(property = "id",column = "id"),
                    @Result(property = "articleId",column = "article_id"),
                    @Result(property = "articles",column = "article_id",
                    one=@One(select = "com.myblog.mapper.Articlemapper.findbyid",fetchType = FetchType.DEFAULT))
            }
    )
    public List<IndexArticle> findindex_article();
}
